//
//  DSSHTaskPointDistributeVC.m
//  DSSH
//
//  Created by lcy on 16/4/14.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHTaskPointDistributeVC.h"
#import "TaskPointDistributeCell.h"
#import "TaskPointDistributeCell2.h"
#import "UIView+Round.h"
@interface DSSHTaskPointDistributeVC ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView*pointTableView;

@end

@implementation DSSHTaskPointDistributeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupViewAndData];
    // Do any additional setup after loading the view.
}
-(void)setupViewAndData
{
    self.title = @"点位分布";
    self.view.backgroundColor = [UIColor whiteColor];
    UIBarButtonItem * backBarBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStylePlain target:self action:@selector(backBarBtnClick)];
    self.navigationItem.leftBarButtonItem = backBarBtn;
    
    //添加详情表
    self.pointTableView =[[ UITableView alloc]initWithFrame:CGRectMake(0, 0, ZYAppWidth, ZYAppHeight-80) style:UITableViewStylePlain];
    self.pointTableView.delegate = self;
    self.pointTableView.dataSource = self;
    self.pointTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.pointTableView];
    
    UIButton * contrastBtn = [UIButton new];
    [contrastBtn getRoundView:5];
    [contrastBtn setTitle:@"上刊对比" forState:UIControlStateNormal];
    contrastBtn.titleLabel.font = FONT(13);
    [contrastBtn setBackgroundColor:COLOR_NAVIGATE_BAR];
    [contrastBtn addTarget:self action:@selector(clickContrastBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:contrastBtn];
    
    UIButton * louPaiBtn = [UIButton new];
    [louPaiBtn getRoundView:5];
    [louPaiBtn setTitle:@"查漏拍" forState:UIControlStateNormal];
    louPaiBtn.titleLabel.font = FONT(13);
    [louPaiBtn setBackgroundColor:COLOR_NAVIGATE_BAR];
    [louPaiBtn addTarget:self action:@selector(clickLouPaiBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:louPaiBtn];
    
    [contrastBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).with.offset(10*WIDTH_SCALE);
        make.bottom.equalTo(self.view.mas_bottom).with.offset(-30*HIGHT_SCALE);
        make.size.mas_equalTo(CGSizeMake(150*WIDTH_SCALE, 35*HIGHT_SCALE));
    }];
    [louPaiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.mas_right).with.offset(-10*WIDTH_SCALE);
        make.bottom.equalTo(self.view.mas_bottom).with.offset(-30*HIGHT_SCALE);
        make.size.mas_equalTo(CGSizeMake(150*WIDTH_SCALE, 35*HIGHT_SCALE));
    }];
}

-(void)backBarBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma 点击上刊对比
-(void)clickContrastBtn
{
    
}
#pragma 点击查漏拍
-(void)clickLouPaiBtn
{
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0)
    {
        TaskPointDistributeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellID1"];
        if (!cell)
        {
            cell = [[NSBundle mainBundle]loadNibNamed:@"TaskPointDistributeCell" owner:nil options:nil][0];
        }
        cell.bgView1.layer.borderWidth = 1;
        cell.bgView1.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.bgView1 getRoundView:5];
        return cell;
        
    }else
    {
        TaskPointDistributeCell2 * cell = [tableView dequeueReusableCellWithIdentifier:@"cellID2"];
        if (!cell)
        {
            cell = [[NSBundle mainBundle]loadNibNamed:@"TaskPointDistributeCell2" owner:nil options:nil][0];
        }
        cell.bgView2.layer.borderWidth = 1;
        cell.bgView2.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.bgView2 getRoundView:5];
        cell.smallView1.layer.borderWidth = 1;
        cell.smallView1.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.smallView1 getRoundView:5];
        
        cell.smallView2.layer.borderWidth = 1;
        cell.smallView2.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.smallView2 getRoundView:5];
        
        cell.smallView3.layer.borderWidth = 1;
        cell.smallView3.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.smallView3 getRoundView:5];
        
        [cell.imageView1 getRoundView:7];
        [cell.imageView2 getRoundView:7];
        [cell.imageView3 getRoundView:7];

        
        return cell;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0)
    {
        return 125;
    }else
    {
        return 180;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
